package com.lxf.service;

import com.lxf.dao.UserDao;
import com.lxf.pojo.Product;
import com.lxf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;


@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

//登录查看用户是否存在
    @Override
    public User logins(String userName) {
        return userDao.logins(userName);
    }

    @Override
    public User userInfoId(int id) {
        return userDao.userInfoId(id);
    }

    //查看用户全部收货地址
    @Override
    public List<User> LookFoot(int id) {
        return userDao.LookFoot(id);
    }

    //用户注册
    @Override
    public int insert(User user) {
        return userDao.insert(user);
    }
//添加用户足迹
    @Override
    public int AddFoot(int productId,int id) {
        return userDao.AddFoot(productId,id);
    }

    @Override
    public boolean delFoot(int id) {
       return userDao.delFoot(id);
    }

    @Override
    public int userUpdate(User u) {
        return userDao.userUpdate(u);
    }

    @Override
    public int insertCollect(int userId, int productId) {
        return userDao.insertCollect(userId,productId);
    }

    @Override
    public int deluserCollect(int userId,int productId) {
        return userDao.deluserCollect(userId,productId);
    }

    @Override
    public int recharge(double money,String userName) {
        return userDao.recharge(money,userName);
    }

    @Override
    public User account(int id) {
        return userDao.account(id);
    }

    @Override
    public int updateAccountUserName(String userName,String userNames) {
        return userDao.updateAccountUserName(userName,userNames);
    }

    @Override
    public User byIdInfoAddress(int id) {
        return userDao.byIdInfoAddress(id);
    }

    @Override
    public List<User> infoConsume(int userId) {
        return userDao.infoConsume(userId);
    }

    @Override
    public int Addaddress(User user) {
        return userDao.Addaddress(user);
    }

    @Override
    public int delelteAddress(int id) {
        return userDao.delelteAddress(id);
    }

    @Override
    public int updateAddress(User user) {
        return userDao.updateAddress(user);
    }

    @Override
    public int quxiaoDefault(int id) {
        return userDao.quxiaoDefault(id);
    }

    @Override
    public int updateUserName(String userName, int id) {
        return userDao.updateUserName(userName,id);
    }


    @Override
    public int addaccount(String userName) {
        return userDao.addaccount(userName);
    }


    @Override
    public int AddOrder(Product p) {
        return userDao.AddOrder(p);
    }

    @Override
    public boolean DelOrder(int id) {
        return userDao.DelOrder(id);
    }
}
